package com.app.service.impl;

import com.app.mapper.PersonPositionMapper;
import com.app.mapper.PersonResumeMapper;
import com.app.model.PersonPositionModel;
import com.app.model.PersonResumeModel;
import com.app.service.PersonPositionService;
import com.app.service.PersonResumeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Primary
public class PersonResumeServiceImpl implements PersonResumeService {
   @Autowired
    PersonResumeMapper personResumeMapper;


    @Override
    public List<PersonResumeModel> getResumeList(int personId) {
        QueryWrapper<PersonResumeModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("id","person_id","start_time","end_time","content").eq("person_id",personId).orderByAsc("start_time");
        List<PersonResumeModel> resumeModelList = personResumeMapper.selectList(queryWrapper);
        return resumeModelList;
    }

    @Override
    public List<PersonResumeModel> listExport(Integer personId) {
        QueryWrapper<PersonResumeModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("id","person_id","start_time","end_time","content").eq("person_id",personId);
        List<PersonResumeModel> resumeModelList = personResumeMapper.selectList(queryWrapper);
        return resumeModelList;
    }

    @Override
    public void update(PersonResumeModel model) {
        personResumeMapper.updateById(model);
    }

    @Override
    public void insert(PersonResumeModel model) {
        personResumeMapper.insert(model);
    }

    @Override
    public void delete(int id) {
        personResumeMapper.deleteById(id);
    }

    @Override
    public PersonResumeModel getById(Integer id) {
        return personResumeMapper.selectById(id);
    }
}
